<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="author" content="广州依旧电子商务有限公司--http://www.19DZ.com" />
		<title>注册</title>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/style.css" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/idangerous.swiper.css" />
	</head>

	<body style="background-color: #fff;">
		<!--头部-->
		<include file="Public:header" />
		<!--头部  End-->
		<div class="login-body">
			<div class="login-content">
				<div class="login-title">用户注册</div>
				<form method='post' id="form_do" name="form_do" action="{:U(MODULE_NAME. '/Public/register')}">
				<div class="login-main">
					<div class="login-main-text">
						<input type="text" name="email" placeholder="请输入邮箱" id="email">
					</div>
					<div class="login-main-alert" id="email-alert"></div>
					<div class="login-main-text">
						<input type="text" name="password" pattern="[0-9a-zA-Z]{5,13}" placeholder="密码长度为6-14个字符的数字与字母组合" id="pwd">
					</div>
					<div class="login-main-alert" id="pwd-alert"></div>

				<if condition="C('CFG_VERIFY_REGISTER') eq 1">
					<div class="login-main-text1">
						<input type="text" name="vcode" placeholder="请输入图片验证码" id="vcode">
						<img src="<yang:vcodeurl />" id="VCode" onclick="javascript:changeVcode(this);" />
					</div>
				</if>
					<div class="login-main-alert" id="vcode-alert"></div>
					<div class="login-main-text1">
						<input type="text" name="emailcode" placeholder="邮箱验证码" id="ecode">
						<button id="sendEmailCode" type="button">获取邮箱验证码</button>
					</div>
					<div class="login-main-alert" id="ecode-alert"></div>
					<button id="reg">注册</button>
				</div>
				</form>
			</div>
		</div>
		

		<!--尾部-->
		<include file="Public:footer" />
		<!--尾部   End-->

		<script type="text/javascript" src="__PUBLIC__/js/jquery-1.11.1.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/js/idangerous.swiper.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/js/myjs.js"></script>
	</body>

</html>

<script type="text/javascript">
function changeVcode(obj){
	$("#VCode").attr("src",'<yang:vcodeurl />'+ '#'+Math.random());
	return false;
}

$("#sendEmailCode").click(function(){
	var $chkurl = "{:U('Public/sendCodeAjax')}";
	var param = {};
	param.email = $("#email").val();
	param.vcode = $("#vcode").val();
	if(!param.email){
		alert("E-mail格式不能为空");
		return false;
	}
	if(!param.vcode){
		alert("图片验证码不能为空");
		return false;
	}
	$.get($chkurl,param,function(data){
		if (data.status==1) {
			alert(data.info);
			time = 60;
			$('#sendEmailCode').attr('disabled', 'disabled').html('60秒获取');
			var task = setInterval(function(){
				time--;
				$('#sendEmailCode').html(''+time+"秒获取");
				if(time==0){
					isSend = false;
					clearInterval(task);
					$('#sendEmailCode').removeAttr('disabled').html("重新发送");
				}
			},1000);
		}else{
			alert(data.info);
			changeVcode();
		}
	})
});
$("#email").blur(function(){
	var a = $("#email");
    if ($.trim(a.val()) == '') {
    	$("#email-alert").text("邮箱不能为空");
    };
});
$("#email").focus(function(){
	$("#email-alert").text("");
});
$("#pwd").blur(function(){
	var a = $("#pwd");
    if ($.trim(a.val()) == '') {
    	$("#pwd-alert").text("请输入密码");
    };
});
$("#pwd").focus(function(){
	$("#pwd-alert").text("");
});
$("#vcode").blur(function(){
	var a = $("#vcode");
    if ($.trim(a.val()) == '') {
    	$("#vcode-alert").text("请输入验证码");
    };
});
$("#vcode").focus(function(){
	$("#vcode-alert").text("");
});
$("#ecode").blur(function(){
	var a = $("#ecode");
    if ($.trim(a.val()) == '') {
    	$("#ecode-alert").text("请输入验证码");
    };
});
$("#ecode").focus(function(){
	$("#ecode-alert").text("");
});
</script>